
var formStore=new Object();
function printobj(obj){
  //eval(obj.functionname);
  var str = '';
  for(prop in obj){
    if(typeof(obj[prop]) != 'function')
      str += prop + ':' + obj[prop] + '\n';
    //else
    //  str += prop + ':' + typeof(obj[prop]) + '\n';
  }
  return str;
}

Ext.onReady(function() {
	
	var  openUrl1 = '?className=com.jsepc.jhtj.monthly.tools.Compare';
           openUrl1 += '&methodName=getSelectinfo';
           openUrl1 += '&paramCount=0';
         
           
    
     var store = new Ext.data.Store({
              proxy : new Ext.data.HttpProxy({
                        url : basePath+'JarpListener' + openUrl1
      }),
           reader : new Ext.data.JsonReader({
 				id : 'tongybm'
 				}, ['F_VC_BIANMZ','F_VC_BIANMMC']),
					remoteSort : false
     }); 
		
     store.load();
    
	
		var bd_Action=new Ext.Action(
		{
				text : '指标更新',
				handler : function() {
					fcompare();
				},
				iconCls : 'bd'
		}
		)
	
	var cm = new Ext.grid.ColumnModel([
		{
			width: 10,
			header:'<center>id</center>',
			id:'F_VC_BIANMZ',
			hidden:true,
			dataIndex:'F_VC_BIANMZ'
		},
		{	
			width: 200,
			header:'<center>公司名称</center>',
			id:'F_VC_BIANMMC',
			sortable:false,
			dataIndex:'F_VC_BIANMMC'
		}
	]);
	
	var grid = new Ext.grid.EditorGridPanel({
			enableHdMenu  :false,
 			store : store,
 			id:'grid_id',
			cm:cm,
			height:530,
			width : '100%',
			viewConfig: {forceFit: true},
			autoExpandColumn:'F_VC_BIANMMC',
			frame:false,
			clicksToEdit:1,
			stripeRows : true
		});
	
		var simple = new Ext.FormPanel({
				labelWidth: 70, 
				frame:true,
				height:40,
				layout : 'form',
 				bodyStyle:'padding:5px 5px 0',
				id:'simple',
 				width: '100%',
 				items: [
 				   {
 					layout : 'column',
					items : [
					{
						columnWidth : .20,
						layout : 'form',
						border : false,
						labelAlign : 'right',
						hideLabel:false,
				
						items : [new Ext.form.ComboBox({
								store: new Ext.data.SimpleStore(
								{
									fields: ["retrunValue", "displayText"],
									data: [[3,'年度预控计划'],[4,'年度调整计划']]
								}),
 						fieldLabel: '综合计划',
						valueField :"retrunValue",
						displayField: "displayText",
						id:'zh',
 						typeAhead: true,
 						mode: 'local',
						triggerAction: 'all',
 						emptyText:'',
						value:'',
						selectOnFocus:true,
						anchor:'100%',
						width:'100%'
 					})]
				 },{
    				columnWidth : .20,
						layout : 'form',
						border : false,
						labelAlign : 'right',
						hideLabel:false,
					
						items : [new Ext.form.ComboBox({
								store: new Ext.data.SimpleStore(
								{
									fields: ["retrunValue", "displayText"],
									data: [[2000,'2000'],[2001,'2001'],[2002,'2002'],[2003,'2003'],[2004,'2004'],[2005,'2005'],[2006,'2006'],[2007,'2007'],[2008,'2008'],[2009,'2009'],[2010,'2010'],[2011,'2011'],[2012,'2012'],[2013,'2013'],[2014,'2014'],[2015,'2015']]
								}),
 						fieldLabel: '年度',
						valueField :"retrunValue",
						displayField: "displayText",
						id:'yy',
 						typeAhead: true,
 						mode: 'local',
						triggerAction: 'all',
 						emptyText:'',
						value:'',
						selectOnFocus:true,
						anchor:'100%',
						width:'100%'
 					})]
				}	
		]
		}]
		});
		
		var p_itemManager = new Ext.Panel({
				id : 'p_itemManager',
				frame : true,
				width : '100%',
				layout : 'form',
				bodyStyle : 'padding: 4px',
				tbar : ['-',bd_Action,'-'],
				items : [simple]
		});
		var viewport = new Ext.Viewport({
				layout : 'border',
				frame : true,
				items : [{
				region : 'north',
				height : 90,
				items : p_itemManager
			}, {
				region : 'center',
				layout : 'fit',
				items : grid
		}]
		});
		
		function fcompare()
		{
					
					var ywbh = Ext.ComponentMgr.get("zh").getValue();
					var yy = Ext.ComponentMgr.get("yy").getRawValue();
					var ProjInfoUrl = ""; 
 					ProjInfoUrl = '?className=com.jsepc.jhtj.monthly.tools.getStringInteface';
 					ProjInfoUrl += '&methodName=getCompareData';
 					ProjInfoUrl += '&paramCount=2';
          		　　 ProjInfoUrl += '&param_0='+ywbh;
          		　　 ProjInfoUrl += '&param_1='+yy ;
 				　　 ProjInfoUrl =   basePath+'JarpListener' + ProjInfoUrl;
 					httpReq=null; 					
 					httpReq = getXMLHttpRequest();	
 					httpReq.onreadystatechange = returnItemSave;
 					httpReq.open("POST",ProjInfoUrl, true);
 					httpReq.send(Ext.util.JSON.encode(null));
 					
		}
		
		function returnItemSave()
		{
			if(httpReq.readyState == 4){
					if(httpReq.status == 200){  
 				 		ret = httpReq.responseText;
 						Ext.MessageBox.alert('提示',ret);	
					}
			}
		}
})